﻿#include "stdafx.h"
#include "FindDuplicate.h"

using namespace std;

namespace algorithm {
int CFindDuplicate::Find(vector<int>& nums)
{
    bitset<100000> bs;
    for (int i = 0; i < (int)nums.size(); i++) {
        if (bs[nums[i]]) {
            return nums[i];
        }
        bs[nums[i]] = 1;
    }
    return -1;
}
}
